package com.yanqu.road.server.cmd.marriage.crossworld;

import com.yanqu.road.entity.marriage.MarriageInfo;
import com.yanqu.road.logic.pb.MarriagePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.marriage.CrossMarriageProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.marriage.CrossUnionWorldMarriageMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CROSS_WORLD_MARRIAGE_APPLY_PUBLISH, desc = "发布全服联姻")
public class CrossWorldMarriagePublishCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossMarriageProto.CrossMarriageApplyPublishCrossReqMsg reqMsg = CrossMarriageProto.CrossMarriageApplyPublishCrossReqMsg.parseFrom(packet.getBytes());
        MarriageInfo marriageInfo = MarriagePb.parseMarriageInfo(reqMsg.getApplyData());
        CrossUnionWorldMarriageMgr.publish(serverId, marriageInfo);
    }

    @Override
    public void sendData() {

    }
}
